package com.aiyige.page.publish.learnvideo.model;

import android.os.Parcel;
import android.os.Parcelable;

import com.aiyige.location.model.LocationData;
import com.aiyige.page.interest.model.Interest;
import com.aiyige.page.publish.guarantee.model.GuaranteeItem;
import com.aiyige.page.publish.selectcoursetype.model.CourseTypeItem;
import com.aiyige.page.publish.selectinterest.model.PublishIndustryItem;
import com.aiyige.page.publish.selectinterest.model.PublishInterestItem;
import com.aiyige.page.publish.selectlearntarget.model.SelectLearnTargetItem;
import com.aiyige.page.publish.selectsuitablepeople.model.SelectSuitablePeopleItem;
import com.aiyige.page.publish.selecttag.model.SelectTagItem;
import com.aiyige.page.publish.selectteacher.model.TeacherItem;
import com.aiyige.page.publish.util.PublishUtil;
import com.aiyige.utils.StringUtils;

import java.util.LinkedList;
import java.util.List;

/**
 * Created by zhuyakun on 2017/11/14.
 */

public class PublishLearnVideoFormModel implements Parcelable {
    String title;
    String coverUrl;
    String price;
    String priceId;
    String courseType;
    List<Interest> interestList;
    List<Interest> industryList;
    String suitablePeople;
    String learnTarget;
    String teacher;
    String courseIntroduction;
    List<PublishLearnVideoItem> publishLearnVideoItemList;
    List<GuaranteeItem> selectGuaranteeItemList;
    String goodsId;
    int version;
    int operationType;
    LocationData locationData;
    String platformDividend;

    public PublishLearnVideoFormModel() {
    }

    private PublishLearnVideoFormModel(Builder builder) {
        setTitle(builder.title);
        setCoverUrl(builder.coverUrl);
        setPrice(builder.price);
        setPriceId(builder.priceId);
        setCourseType(builder.courseType);
        setInterestList(builder.interestList);
        setIndustryList(builder.industryList);
        setSuitablePeople(builder.suitablePeople);
        setLearnTarget(builder.learnTarget);
        setTeacher(builder.teacher);
        setCourseIntroduction(builder.courseIntroduction);
        setPublishLearnVideoItemList(builder.publishLearnVideoItemList);
        setSelectGuaranteeItemList(builder.selectGuaranteeItemList);
        setGoodsId(builder.goodsId);
        setVersion(builder.version);
        setOperationType(builder.operationType);
        setLocationData(builder.locationData);
        setPlatformDividend(builder.platformDividend);
    }

    public static Builder newBuilder() {
        return new Builder();
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getCoverUrl() {
        return coverUrl;
    }

    public void setCoverUrl(String coverUrl) {
        this.coverUrl = coverUrl;
    }

    public String getPrice() {
        return price;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public String getPriceId() {
        return priceId;
    }

    public void setPriceId(String priceId) {
        this.priceId = priceId;
    }

    public String getCourseType() {
        return courseType;
    }

    public void setCourseType(String courseType) {
        this.courseType = courseType;
    }

    public List<Interest> getInterestList() {
        return interestList;
    }

    public void setInterestList(List<Interest> interestList) {
        this.interestList = interestList;
    }

    public List<Interest> getIndustryList() {
        return industryList;
    }

    public void setIndustryList(List<Interest> industryList) {
        this.industryList = industryList;
    }

    public String getSuitablePeople() {
        return suitablePeople;
    }

    public void setSuitablePeople(String suitablePeople) {
        this.suitablePeople = suitablePeople;
    }

    public String getLearnTarget() {
        return learnTarget;
    }

    public void setLearnTarget(String learnTarget) {
        this.learnTarget = learnTarget;
    }

    public String getTeacher() {
        return teacher;
    }

    public void setTeacher(String teacher) {
        this.teacher = teacher;
    }

    public String getCourseIntroduction() {
        return courseIntroduction;
    }

    public void setCourseIntroduction(String courseIntroduction) {
        this.courseIntroduction = courseIntroduction;
    }

    public List<PublishLearnVideoItem> getPublishLearnVideoItemList() {
        return publishLearnVideoItemList;
    }

    public void setPublishLearnVideoItemList(List<PublishLearnVideoItem> publishLearnVideoItemList) {
        this.publishLearnVideoItemList = publishLearnVideoItemList;
    }

    public List<GuaranteeItem> getSelectGuaranteeItemList() {
        return selectGuaranteeItemList;
    }

    public void setSelectGuaranteeItemList(List<GuaranteeItem> selectGuaranteeItemList) {
        this.selectGuaranteeItemList = selectGuaranteeItemList;
    }

    public String getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(String goodsId) {
        this.goodsId = goodsId;
    }

    public int getVersion() {
        return version;
    }

    public void setVersion(int version) {
        this.version = version;
    }

    public int getOperationType() {
        return operationType;
    }

    public void setOperationType(int operationType) {
        this.operationType = operationType;
    }

    public LocationData getLocationData() {
        return locationData;
    }

    public void setLocationData(LocationData locationData) {
        this.locationData = locationData;
    }

    public String getPlatformDividend() {
        return platformDividend;
    }

    public void setPlatformDividend(String platformDividend) {
        this.platformDividend = platformDividend;
    }

    public static final class Builder {
        private String title;
        private String coverUrl;
        private String price;
        private String priceId;
        private String courseType;
        private List<Interest> interestList;
        private List<Interest> industryList;
        private String suitablePeople;
        private String learnTarget;
        private String teacher;
        private String courseIntroduction;
        private List<PublishLearnVideoItem> publishLearnVideoItemList;
        private List<GuaranteeItem> selectGuaranteeItemList;
        private String goodsId;
        private int version;
        private int operationType;
        private LocationData locationData;
        private String platformDividend;

        private Builder() {
            title = "";
            coverUrl = "";
            price = "";
            priceId = "";
            courseType = "";
            interestList = new LinkedList<>();
            industryList = new LinkedList<>();
            suitablePeople = "";
            learnTarget = "";
            teacher = "";
            courseIntroduction = "";
            publishLearnVideoItemList = new LinkedList<>();
            selectGuaranteeItemList = new LinkedList<>();
            goodsId = null;
            version = 0;
            operationType = PublishUtil.OPERATION_TYPE_CREATE;
            locationData = new LocationData();
            platformDividend = "";
        }

        public Builder title(String val) {
            title = val;
            return this;
        }

        public Builder coverUrl(String val) {
            coverUrl = val;
            return this;
        }

        public Builder price(String val) {
            price = val;
            return this;
        }

        public Builder priceId(String val) {
            priceId = val;
            return this;
        }

        public Builder courseType(String val) {
            courseType = val;
            return this;
        }

        public Builder interestList(List<Interest> val) {
            interestList = val;
            return this;
        }

        public Builder industryList(List<Interest> val) {
            industryList = val;
            return this;
        }

        public Builder suitablePeople(String val) {
            suitablePeople = val;
            return this;
        }

        public Builder learnTarget(String val) {
            learnTarget = val;
            return this;
        }

        public Builder teacher(String val) {
            teacher = val;
            return this;
        }

        public Builder courseIntroduction(String val) {
            courseIntroduction = val;
            return this;
        }

        public Builder publishLearnVideoItemList(List<PublishLearnVideoItem> val) {
            publishLearnVideoItemList = val;
            return this;
        }

        public Builder selectGuaranteeItemList(List<GuaranteeItem> val) {
            selectGuaranteeItemList = val;
            return this;
        }

        public Builder goodsId(String val) {
            goodsId = val;
            return this;
        }

        public Builder version(int val) {
            version = val;
            return this;
        }

        public Builder operationType(int val) {
            operationType = val;
            return this;
        }

        public Builder locationData(LocationData val) {
            locationData = val;
            return this;
        }

        public Builder platformDividend(String val) {
            platformDividend = val;
            return this;
        }

        public PublishLearnVideoFormModel build() {
            return new PublishLearnVideoFormModel(this);
        }
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.title);
        dest.writeString(this.coverUrl);
        dest.writeString(this.price);
        dest.writeString(this.priceId);
        dest.writeString(this.courseType);
        dest.writeTypedList(this.interestList);
        dest.writeTypedList(this.industryList);
        dest.writeString(this.suitablePeople);
        dest.writeString(this.learnTarget);
        dest.writeString(this.teacher);
        dest.writeString(this.courseIntroduction);
        dest.writeTypedList(this.publishLearnVideoItemList);
        dest.writeTypedList(this.selectGuaranteeItemList);
        dest.writeString(this.goodsId);
        dest.writeInt(this.version);
        dest.writeInt(this.operationType);
        dest.writeParcelable(this.locationData, flags);
        dest.writeString(this.platformDividend);
    }

    protected PublishLearnVideoFormModel(Parcel in) {
        this.title = in.readString();
        this.coverUrl = in.readString();
        this.price = in.readString();
        this.priceId = in.readString();
        this.courseType = in.readString();
        this.interestList = in.createTypedArrayList(Interest.CREATOR);
        this.industryList = in.createTypedArrayList(Interest.CREATOR);
        this.suitablePeople = in.readString();
        this.learnTarget = in.readString();
        this.teacher = in.readString();
        this.courseIntroduction = in.readString();
        this.publishLearnVideoItemList = in.createTypedArrayList(PublishLearnVideoItem.CREATOR);
        this.selectGuaranteeItemList = in.createTypedArrayList(GuaranteeItem.CREATOR);
        this.goodsId = in.readString();
        this.version = in.readInt();
        this.operationType = in.readInt();
        this.locationData = in.readParcelable(LocationData.class.getClassLoader());
        this.platformDividend = in.readString();
    }

    public static final Creator<PublishLearnVideoFormModel> CREATOR = new Creator<PublishLearnVideoFormModel>() {
        @Override
        public PublishLearnVideoFormModel createFromParcel(Parcel source) {
            return new PublishLearnVideoFormModel(source);
        }

        @Override
        public PublishLearnVideoFormModel[] newArray(int size) {
            return new PublishLearnVideoFormModel[size];
        }
    };
}
